package com.wyw.function.learning.demo1;

import com.wyw.function.learning.common.Person;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

/**
 * @Title   构造方法的引用
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * Update History:
 * Author        Time            Content
 */
public class StructureMethodClient {
    public static void main(String[] args) {

        Supplier<List<Person>> supplier = () -> new ArrayList<Person>();
        List<Person> people = supplier.get();
        people.add(new Person("wyw", 18));
        System.out.println(people);

        Supplier<List<Person>> supplier1 = ArrayList<Person>::new;
        List<Person> people1 = supplier1.get();
        people1.add(new Person("wyw1", 18));
        people1.add(new Person("wyw2", 19));
        System.out.println(people1);
    }
}
